// 处理首页顶部图片轮播
$(function () {
    initTopSwiper();
    initSwiperMenu();
})

function initTopSwiper() {
    let img_length = $("#topSwiper img").length;
    if (img_length < 2) {
        new Swiper("#topSwiper", {
            loop: false
        });
    } else {
        new Swiper("#topSwiper", {
            loop: true,
            autoplay: 2500,
            pagination: ".swiper-pagination"
        });
    }
}

function initSwiperMenu() {
    let img_length = $("#swiperMenu img").length
    if (img_length < 4) {
        new Swiper("#swiperMenu", {
            loop: false
        });
    } else {
        new Swiper("#swiperMenu", {
            loop: true,
            autoplay: 2500,
            slidesPerView: 3
        });
    }
}